package com.menghanjun.mhjresourcesharing.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/goto")
public class InputController {

    @RequestMapping("/{path}")
    public String Goto(@PathVariable String path){
        return path;
    }

    @RequestMapping("/{dir}/{path}")
    public String Goto(@PathVariable String dir, @PathVariable String path){
        return dir+"/"+path;
    }

    @RequestMapping("/redirect/{path}")
    public ModelAndView redirectGoto(@PathVariable String path){
        ModelAndView modelAndView=new ModelAndView(path);
        return modelAndView;
    }

    @RequestMapping("/redirect/{dir}/{path}")
    public ModelAndView redirectGoto(@PathVariable String dir, @PathVariable String path){
        ModelAndView modelAndView=new ModelAndView(dir+"/"+path);
        return modelAndView;
    }
}
